package com.cmb;

public class DefaultProduct extends Product {
    public DefaultProduct(String name, int sellIn, int quality) {
        super(name, sellIn, quality);
    }

    @Override
    public void update() {
        int sellIn = getSellIn();
        int quality = getQuality();
        if (sellIn == 0) {
            setQuality(Math.max(quality - 2, 0));
        } else {
            setQuality(Math.max(quality - 1, 0));
            setSellIn(--sellIn);
        }
    }
}
